<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        img {
            width: 15px;
            height: 15px;
        }

        div {
            /* color: greenyellow; */
            /* color: red; */
        }
    </style>
</head>

<body>
    <input type="password"><img src="./对.png" alt="">
    <div>请输入6到16为密码</div>
</body>

</html>
<script>
    var inp = document.querySelector('input');
    var img = document.querySelector('img');
    var div = document.querySelector('div');
    inp.onblur = function () {
        if (inp.value.length > 6 && inp.value.length < 16) {
            img.src = './对.png';
            div.style.color = 'red';
        } else {
            img.src = './错.png';
            div.style.color = 'greenyellow';
        }
    }



</script>